<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:costa="http://stdio.costa/facelets"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich"
	template="/WEB-INF/layout/template.xhtml">
	<f:metadata>
		<f:viewParam name="id" value="#{osHome.id}">
			<f:convertNumber integerOnly="#{true}" />
		</f:viewParam>
		<f:event type="preRenderView" listener="#{osHome.postConstruct}" />
	</f:metadata>
	<ui:define name="content">
		<h:form prependId="false">
			<rich:validator event="change">
			<h:panelGrid id="osDetail" columns="3">
				<costa:outputText id="id" value="#{osHome.entity.id}" label="#{messages.id}" />
				<costa:inputText id="name" value="#{osHome.entity.name}" label="#{messages.name}" />
				<costa:inputText id="version" value="#{osHome.entity.version}" label="#{messages.version}" />
			</h:panelGrid>
			</rich:validator>
			<h:commandButton action="#{osHome.save}" value="#{messages.save}" />
		</h:form>
		<h:form prependId="false">
            <rich:dataTable value="#{osQuery.dataModel}" var="os" id="osTable" rows="#{osQuery.dataTable.pageSize}" keepSaved="true">
				<costa:column header="#{messages.id}" value="#{os.id}" property="id" dataTable="#{osQuery.dataTable}" tableId="osTable" scrollerId="osScroller" />
				<costa:column header="#{messages.name}" value="#{os.name}" property="name" dataTable="#{osQuery.dataTable}" tableId="osTable" scrollerId="osScroller" />
				<costa:column header="#{messages.version}" value="#{os.version}" property="version" dataTable="#{osQuery.dataTable}" tableId="osTable" scrollerId="osScroller" />
				<rich:column>
					<a4j:commandLink render="osDetail" execute="@this">
	                    #{messages.edit}
	                    <f:setPropertyActionListener target="#{osHome.entity}" value="#{os}" />
                	</a4j:commandLink>
                	<br /><br />
                	<a4j:commandLink execute="@this">
	                    #{messages.delete}
	                    <rich:componentControl event="click" operation="show" target="deleteConfirm">
							<a4j:param name="event" value="event" noEscape="true" />
						</rich:componentControl>
                	</a4j:commandLink>
                	<rich:popupPanel id="deleteConfirm" autosized="true" modal="true" moveable="false" resizeable="false" followByScroll="false">
						<h:outputFormat value="#{messages['tip.delete']}">
							<f:param value="#{os.name}" />
						</h:outputFormat>
						<h:panelGroup>
							<h:commandButton onclick="#{rich:component('deleteConfirm')}.hide(event); return true;" action="#{osHome.delete(os.id)}" value="#{messages.confirm}" />
							<a4j:commandButton onclick="#{rich:component('deleteConfirm')}.hide(event); return false;" value="#{messages.cancel}" />
						</h:panelGroup>
					</rich:popupPanel>
				</rich:column>
				<f:facet name="footer">
	                <rich:dataScroller id="osScroller" />
	            </f:facet>
            </rich:dataTable>
		</h:form>
	</ui:define>
</ui:composition>
